import { useState } from "react";

export default function globalModal() {
	const [modalVisible, setModalVisible] = useState(false);
	const [modalTitle, setModalTitle] = useState(null);
	const [modalWidth, setModalWidth] = useState(480);
	const [modalComponent, setModalComponent] = useState(null);
	const [modalStyle, setModalStyle] = useState({ top: 100 });

	const onCloseGlobalModal = () => {
		setModalVisible(false);
		setModalTitle(null);
		setModalComponent(null);
		setModalStyle({ top: 100 });
	};

	return {
		modalVisible,
		modalTitle,
		modalWidth,
		modalStyle,
		modalComponent,
		setModalVisible,
		setModalTitle,
		setModalWidth,
		setModalComponent,
		setModalStyle,
		onCloseGlobalModal,
	};
}
